(defparameter *OS* (ext:getenv "OS"))
(defparameter *HOME* (if (equalp (ext:getenv "OS") "Windows_NT") "" "~"))

;wrt trunk dir
(defvar *icarus-core-files* '("new_icarus/compiler.lisp"
			      "new_icarus/initial.lisp"
			      "new_icarus/icarus.new.lisp"
			      "new_icarus/interpreter.lisp"
			      "new_icarus/matcher.lisp"
			      "new_icarus/parameter-learner.lisp"
			      "new_icarus/problem-solver.lisp"
			      "new_icarus/skill-learner.lisp"
			      "new_icarus/theory-revision.lisp"))

(defvar *cleaned_FastMatcher-files* '("cleaned_FastMatcher/StanfordCompatible.lisp"
				      "cleaned_FastMatcher/update1.lisp"
				      "cleaned_FastMatcher/updatenew.lisp"
				      "cleaned_FastMatcher/temporal/concepts2.lisp"
				      "cleaned_FastMatcher/temporal/plugin.lisp"
				      "cleaned_FastMatcher/temporal/temporal.lisp"
				      "cleaned_FastMatcher/temporal/timetest.lisp"))

(defvar *fastmatcher-files* '("fastmatcher/newicarus.lisp"
			      "fastmatcher/update1.lisp"
			      "fastmatcher/updatenew.lisp"))

(defvar *icarus-domainIndependent-files* (append *icarus-core-files*
						 *cleaned_FastMatcher-files*
						 *fastmatcher-files*))

(defun compile-files (files)
  (do* ((remaining-files files (cdr remaining-files)))
       ((null remaining-files) nil)
       (compile-file (car remaining-files))))


(defun compile-icarus-files ()
  (cd (format nil "~A/tl3/trunk" *HOME*))
  (compile-files *icarus-domainIndependent-files*))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;all about loading compiled and non-compiled versions..

(defvar *load-compiled* nil)

(defun cload (file)
  (when (or (search ".lisp" file) (search ".fas" file))
    (return-from cload (load file)))

  (when *load-compiled*
    (let* ((compiled-file (concatenate 'string file ".fas")))
      ;(format t "compiled-file is ~A~%" compiled-file)
      (when (probe-file compiled-file) 
	(return-from cload (load compiled-file)))))


					;get here if load-compile is false, OR if it is T BUT .fas didnt exist.
					;in either case, we need to append .lisp and load it
      
  (let* ((interpreted-file (concatenate 'string file ".lisp")))
					;dont do probe-. Leave it to func (load ..) to give err if nec.
    (return-from cload (load interpreted-file))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro while (test &rest body)
  `(do ()
	   ((not ,test))
	 ,@body))

